package cn.iocoder.yudao.module.shop.convert.memberpay;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;

import cn.iocoder.yudao.module.shop.dal.dataobject.memberpay.ShopMemberPayItemDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import cn.iocoder.yudao.module.shop.controller.admin.memberpay.vo.*;
import cn.iocoder.yudao.module.shop.dal.dataobject.memberpay.ShopMemberPayDO;

/**
 * 每支价格 Convert
 *
 * @author 曹建伟
 */
@Mapper
public interface ShopMemberPayConvert {

    ShopMemberPayConvert INSTANCE = Mappers.getMapper(ShopMemberPayConvert.class);

    ShopMemberPayDO convert(ShopMemberPayCreateReqVO bean);

    ShopMemberPayDO convert(ShopMemberPayUpdateReqVO bean);

    ShopMemberPayRespVO convert(ShopMemberPayDO bean);

    List<ShopMemberPayRespVO> convertList(List<ShopMemberPayDO> list);

    PageResult<ShopMemberPayRespVO> convertPage(PageResult<ShopMemberPayDO> page);

    List<ShopMemberPayExcelVO> convertList02(List<ShopMemberPayDO> list);


    default ShopMemberPayItemDO convertItem(ShopMemberPayItemUpdateReqVO bean){
        if(bean == null) {
            return null;
        }

        ShopMemberPayItemDO.ShopMemberPayItemDOBuilder shopMemberPayItemDO = ShopMemberPayItemDO.builder();
        shopMemberPayItemDO.id(bean.getId());
        shopMemberPayItemDO.memberId(bean.getMemberId());
        shopMemberPayItemDO.priceId(bean.getPriceId());

        return shopMemberPayItemDO.build();
    }

    default ShopMemberPayItemDO convertItem(ShopMemberPayItemCreateReqVO bean) {
        if(bean == null) {
            return null;
        }

        ShopMemberPayItemDO.ShopMemberPayItemDOBuilder shopMemberPayItemDO = ShopMemberPayItemDO.builder();

        shopMemberPayItemDO.memberId(bean.getMemberId());
        shopMemberPayItemDO.priceId(bean.getPriceId());

        return shopMemberPayItemDO.build();
    }

    default ShopMemberPayItemUpdateReqVO convertUpdateReq(ShopMemberPayItemDO payItemDO, ShopMemberPayItemCreateReqVO createReqVO) {
        ShopMemberPayItemUpdateReqVO updateReqVO = new ShopMemberPayItemUpdateReqVO();
        updateReqVO.setId(payItemDO.getId());
        updateReqVO.setMemberId(createReqVO.getMemberId());
        updateReqVO.setPriceId(createReqVO.getPriceId());

        return updateReqVO;
    }

    default ShopMemberPayItemDO convertItem(Long priceId, Long memberId){

        ShopMemberPayItemDO.ShopMemberPayItemDOBuilder shopMemberPayItemDO = ShopMemberPayItemDO.builder();
        shopMemberPayItemDO.memberId(memberId);
        shopMemberPayItemDO.priceId(priceId);

        return shopMemberPayItemDO.build();
    }

}
